package com.example.projectcode.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.projectcode.mapper.CrecordMapper;
import com.example.projectcode.model.Crecord;
import com.example.projectcode.service.CrecordService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CrecordServiceImpl extends ServiceImpl<CrecordMapper, Crecord> implements CrecordService {

    @Override
    public int insertCrecord(Crecord crecord) {
        return baseMapper.insert(crecord);
    }

    @Override
    public List<Crecord> selectCrecordByStuId(Integer stuId) {
        QueryWrapper<Crecord> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("Stu_id",stuId);
        return baseMapper.selectList(queryWrapper);
    }

    @Override
    public int deleteChoiceRecordByCRecordid(Integer cRecordid) {

        return baseMapper.delete(new QueryWrapper<Crecord>().eq("C_recordid",cRecordid));
    }
}
